import request from '@/utils/request'

export const getEmployeeList = (params) => {
  return request.get('/sys/user', { params })
}

export const getEmployeeExport = () => {
  return request.get('/sys/user/export', {
    responseType: 'blob'
  })
}

// 导入员工模板
export const getImportTemplate = () => {
  return request.get('/sys/user/import/template', { responseType: 'blob' })
}

// 上传excel
export const uploadExcel = (data) => {
  return request.post('/sys/user/import', data)
}

// 删除员工
export const delEmployee = (id) => {
  return request.delete(`/sys/user/${id}`)
}

// 新增员工
export const addEmployee = (data) => {
  return request.post('/sys/user', data)
}

// 获取员工详细信息
export const getEmployeeDetail = (id) => {
  return request.get(`/sys/user/${id}`)
}

// 修改员工详细信息
export const editEmployeeDetail = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}

// 获取角色列表
export const getEnableRoleList = () => request.get('/sys/role/list/enabled')

// 员工分配角色
export const assignRole = (data) => request.put('/sys/user/assignRoles', data)
